/**
 * 閿�敭鏈嶅姟绫�
 */
package com.bookshop.pos.services;

import java.util.Vector;

import com.bookshop.pos.dao.CustomerDAO;
import com.bookshop.pos.dao.SalesInDAO;
import com.bookshop.pos.controller.SalesInServicesController;
import com.bookshop.pos.model.Customer;
import com.bookshop.pos.model.Goods;
import com.bookshop.pos.model.SalesIn;

public class SalesInServices implements SalesInServicesController
{
    SalesInDAO salesInDAO=null;
	public SalesInServices()
	{
		super();
	}
	public boolean addSalesIna(SalesIn salesIn)
	{
		salesInDAO=new SalesInDAO();
		boolean result=true;
		result=salesInDAO.addSalesIna(salesIn);
		
				return  result;
	}
	public boolean addSalesIn(SalesIn salesIn)
	{
		salesInDAO=new SalesInDAO();
		boolean result=true;
		result=salesInDAO.addSalesIn(salesIn);
		
				return  result;
	}
	
	public boolean addSalesIn2(SalesIn salesIn)
	{
		salesInDAO=new SalesInDAO();
		boolean result=true;
		result=salesInDAO.addSalesIn2(salesIn);
		
				GoodsServices goodsServices=new GoodsServices();
		    	goodsServices.changeGoodsNumber(salesIn.getGoodsID(), -salesIn.getNumber());
				return  result;
	}
	
	public boolean addSalesIn3(String paymentno,String paymentmethod,String amount,String salrorderid,String createdatetime,String paymentcashier)
	{
		salesInDAO=new SalesInDAO();
		boolean result=true;
		result=salesInDAO.addSalesIn3( paymentno, paymentmethod, amount, salrorderid, createdatetime,paymentcashier);
		
				return  result;
	}


	public Vector<SalesIn> getAllSalesIn()
	{
		salesInDAO=new SalesInDAO();
		return salesInDAO.getAllSalesIn();
	}
	
	public Vector<SalesIn> searchSalesIn(String field, String value)
	{
		salesInDAO=new SalesInDAO();
		return salesInDAO.searchSalesIn(field, value);
	}
	public Vector<SalesIn> searchPortInByTime(String beginTime,String endTime){
		salesInDAO=new SalesInDAO();
		return salesInDAO.searchPortInByTime(beginTime, endTime);
	}

	public Vector<SalesIn> searchSalesIn_producttypeAndTime(String beginTime,String endTime,Vector<Goods> goods){
		salesInDAO=new SalesInDAO();
		return salesInDAO.searchSalesIn_producttypeAndTime(beginTime, endTime,goods);
	}
	
	public boolean isExited(String id)
	{
		salesInDAO=new SalesInDAO();
		return salesInDAO.isExited(id);
	}
	
	 public boolean isExited_goods(String saleorderid,String goodsid)
	 {
			salesInDAO=new SalesInDAO();
			return salesInDAO.isExited_goods( saleorderid, goodsid);
	 }
	

	public SalesIn getSalesInInfo(String id)
	{
		salesInDAO=new SalesInDAO();
		return salesInDAO.getSalesInInfo(id);
	}

	public SalesIn getSalesInInfo_goodsid(String id,String goodsid)
	{
		salesInDAO=new SalesInDAO();
		return salesInDAO.getSalesInInfo_goodsid( id, goodsid);
	}
	public Vector<SalesIn> searchSalesIn_producttype(Vector<Goods> goods){
		salesInDAO=new SalesInDAO();
		return salesInDAO.searchSalesIn_producttype( goods);
	}
	public Vector<SalesIn> searchSalesIn_goodsid(String goodsid){
		salesInDAO=new SalesInDAO();
		return salesInDAO.searchSalesIn_goodsid( goodsid);
	}

	
}
